package com.lame.sbconstant.product.strategy;

import com.lame.detect.vo.ClassMeta;
import com.lame.sbconstant.product.vo.ProductDesc;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.tree.ParseTree;

public class DfServiceStrategy extends ProductActorAdapter {

    private String tpl = "${PACKAGE}.service;\n"+
            "import ${BASE_PKG}.entity.${ENTITY};\n"+
              "import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;\n" +
            "import com.baomidou.mybatisplus.core.metadata.IPage;\n" +
            "import com.baomidou.mybatisplus.extension.plugins.pagination.Page;\n" +
            "import com.baomidou.mybatisplus.extension.service.IService;\n" +
                      "public interface I${ENTITY}Service extends IService<${ENTITY}> {\n" +
                      "}\n";


    @Override
    public String product(Parser parser, ParseTree parseTree, ClassMeta classMeta) {
        return TplTools.generate(classMeta, tpl);
    }

    @Override
    public ProductDesc productDesc(Parser parser, ParseTree parseTree, ClassMeta classMeta) {
        final String generate = TplTools.generate(classMeta, tpl);
        return new ProductDesc("./service/I" + classMeta.getName() + "Service.java", generate, false);
    }
}
